<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">			
		<title>全部分类</title>
		<link href="/Public/one/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css" />
		<link href="/Public/one/basic/css/demo.css" rel="stylesheet" type="text/css" />	

		<link href="/Public/one/css/sortstyle.css" rel="stylesheet" type="text/css" />
		<script src="/Public/one/AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
		<script src="/Public/js/template-native.js"></script>
		<style>
			

		</style>
	</head>

	<body>
		
			<!--顶部导航条 -->
			<div class="am-container header">
				<ul class="message-l">
					<div class="topMessage">
						<div class="menu-hd">
							<?php if($_SESSION['uname'] != false ): ?><a href="#" target="_top" class="h">亲，<?php echo ($_SESSION['uname']); ?></a>
								<a href="/Home/Index/out" target="_top">退出</a>

							<?php else: ?>
								<a href="/Home/Login/index" target="_top" class="h">亲，请登录</a>
								<a href="/Home/Register/index" target="_top">免费注册</a><?php endif; ?>
							
						</div>
					</div>
				</ul>
				<ul class="message-r">
					<div class="topMessage home">
						<div class="menu-hd"><a href="/Home/Index/index" target="_top" class="h">商城首页</a></div>
					</div>
					<div class="topMessage my-shangcheng">
						<div class="menu-hd MyShangcheng"><a href="/Home/Information/index" target="_top"><i class="am-icon-user am-icon-fw"></i>个人中心</a></div>
					</div>
					<div class="topMessage mini-cart">
						<div class="menu-hd"><a id="mc-menu-hd" href="/Home/Shopcart/index" target="_top"><i class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong id="J_MiniCartNum" class="h">
						<?php if($count != false): echo ($count); ?>
						<?php else: ?>
						0<?php endif; ?>
						</strong></a></div>
					</div>
					<div class="topMessage favorite">
						<div class="menu-hd"><a href="#" target="_top"><i class="am-icon-heart am-icon-fw"></i><span>收藏夹</span></a></div>
				</ul>
			</div>

				<!--悬浮搜索框-->

				<div class="nav white">
					<!-- <div class="logo"><img src="/Public/one/images/logo.png" /></div> -->
					<div class="logoBig">
						<li><img src="/Public/one/images/logobig.png" /></li>
					</div>

					<div class="search-bar pr">
					<a name="index_none_header_sysc" href="#"></a>
					<form action="/Home/Search/index" method="get">
						<input id="searchInput" name="search" type="text" placeholder="搜索" autocomplete="off">
						<input id="ai-topsearch" class="submit am-btn"  value="搜索" index="1" type="submit">
					</form>
				</div>
				</div>

				<div class="clear"></div>
			
		
		
		<!--主体-->
		
<div id="nav" class="navfull">
	<div class="area clearfix">
		<div class="category-content" id="guide_2">
			<div class="long-title"><span class="all-goods">全部分类</span><span id="meauBack"><a href="home.html">返回</a></span></div>
			<div class="category" > 
			<ul class="category-list" id="js_climit_li">
			<?php if(is_array($class1)): $i = 0; $__LIST__ = $class1;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cla1): $mod = ($i % 2 );++$i; if($key == 0): ?><li class="appliance js_toggle relative first selected">
				<?php else: ?>

					<li class="appliance js_toggle relative"><?php endif; ?>																																											
			   
				<div class="category-info">
					<h3 class="category-name b-category-name"><i><img src="/Public/one/images/cake.png"></i><a class="ml-22" title="<?php echo ($cla1["name"]); ?>"><?php echo ($cla1["name"]); ?></a></h3>
					<em>&gt;</em></div>
				<div class="menu-item menu-in top">
					<div class="area-in" >
						<div class="area-bg">
							<div class="menu-srot">
								
								<div class="brand-side">
					              <dl class="dl-sort"><dt><span>为您推荐</span></dt>
					                <img src="/Public/one/images/TJ.jpg">
					              </dl>
				                </div>																
								
								<div class="sort-side" style="clear:both">
									<?php if(is_array($cla1["class2"])): $i = 0; $__LIST__ = $cla1["class2"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cla2): $mod = ($i % 2 );++$i;?><dl class="dl-sort">
											<dt><span title="<?php echo ($cla2["name"]); ?>"><?php echo ($cla2["name"]); ?></span></dt>
											<?php if(is_array($cla2["class3"])): $i = 0; $__LIST__ = $cla2["class3"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cla3): $mod = ($i % 2 );++$i;?><dd ><a title="<?php echo ($cla3["name"]); ?>" alt="<?php echo ($cla3["name"]); ?>" onclick="showProduct(this)"><span class="cla3"><?php echo ($cla3["name"]); ?></span></a></dd><?php endforeach; endif; else: echo "" ;endif; ?>
										</dl><?php endforeach; endif; else: echo "" ;endif; ?>

								</div>
								<div style="width:90%;min-height:500px;margin:auto;overflow:hidden" >
									<ul class="am-avg-sm-4 am-thumbnails" id="product">									
									  	

									</ul>




								</div>


								

							</div>

						</div>

					</div>

				</div>

				<b class="arrow"></b>	

				</li><?php endforeach; endif; else: echo "" ;endif; ?>

			</ul>
				


			</div>

		</div>

	</div>

</div>
		<script type="text/html" id="productDetail">
			<%for(var i=0;i<data.length;i++){%>	
				<li style="height:300px;margin-top:10px">
				  	<a href="/Home/Product/index?id=<%=data[i].id%>"> 	
					  	<img class="am-thumbnail" src="<%=data[i].images%>" />
					  	<p><%=data[i].title%></p>
				  	</a>
				</li>

			<%}%>
		</script>





		<script type="text/javascript">
			$(document).ready(function() {
		$("li").click(function() {		
		     	$(this).addClass("selected").siblings().removeClass("selected");
	       })
		})
		</script>
		<div class="clear"></div>
		<!--引导 -->
		<div class="navCir">
			<li><a href="home.html"><i class="am-icon-home "></i>首页</a></li>
			<li  class="active"><a href="sort.html"><i class="am-icon-list"></i>分类</a></li>
			<li><a href="shopcart.html"><i class="am-icon-shopping-basket"></i>购物车</a></li>	
			<li><a href="/Public/one/person/index.html"><i class="am-icon-user"></i>我的</a></li>					
		</div>

		<script type="text/javascript">
			function showProduct(obj){
				var id=$(obj).attr('alt');
				$.get('/Api/Index/selectProduct',{'id':id},function(ret){
					if (ret.status==true) {
						var html=template('productDetail',ret);
						$('#product').html("");
						$('#product').append(html);
					}
					
				})
			}


		    function getParam(name){
			    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			    var l = decodeURI(window.location.search);
			    var r = l.substr(1).match(reg);
			    if (r != null) return unescape(r[2]);
			    return null;
		  	}


			function initShow(){
				var id=getParam('id');
				$.get('/Api/Index/selectProduct',{'id':id},function(ret){
					if (ret.status==true) {
						var html=template('productDetail',ret);
						$('#product').html("");
						$('#product').append(html);

					}
					
				})

			}
			initShow();

			
			//跳转页面的时候更改默认选项
			$('.cla3').closest('#js_climit_li').find('.appliance').each(function(){
				$(this).find('.cla3').each(function(){
					var name=getParam('id');
					if ($(this).html()==name) {
					  $('#js_climit_li').find('.appliance').attr('class','appliance js_toggle relative')
					  $(this).closest('.appliance').attr('class','ppliance js_toggle relative first selected');

					}
				})

			})

		</script>
	</body>

</html>